package com.lyt.springboot.util.algorithm;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class S31 {
    int max = 0;
    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        }
        dfs(root, 0);
        return max;
    }

    public void dfs(TreeNode root, int depth) {
        if (root == null) {
            return;
        }
        if (root.left == null && root.right == null && max<depth)  {
            max = depth;
        }
        dfs(root.left, depth + 1);
        dfs(root.right, depth + 1);

    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;
        }
    }

    public static void main(String[] args) {
        String  a  =new String();
        HashMap<String,String> hashMap = new HashMap<>();
        hashMap.put("1", "lyt");
        hashMap.put("2", "Zyw");
        hashMap.put("3", "Zyw");
        hashMap.put("4", "Zyw");
        hashMap.put("5", "Zyw");
        hashMap.put("6", "Zyw");
        hashMap.put("7", "Zyw");
        hashMap.put("8", "Zyw");
        hashMap.put("9", "Zyw");
        hashMap.put("10", "Zyw");
        hashMap.put("11", "Zyw");
        hashMap.put("12", "Zyw");
        hashMap.put("13", "Zyw");
        hashMap.put("14", "Zyw");
        hashMap.put("15", "Zyw");
        hashMap.put("16", "Zyw");
        hashMap.put("17", "Zyw");
//        String c = hashMap.putIfAbsent("1","lzg");
//        System.out.println(b);
        AtomicInteger atomicInteger = new AtomicInteger();
        atomicInteger.incrementAndGet();
    }
}
